<link href="/assets/css/admin.css" rel="stylesheet" type="text/css"/>
<link href="/assets/css/dialog.css" rel="stylesheet" type="text/css" />
<body>
<div class="pad-10">
<form id="form1" action="?m=class&a=index" method="post">
<div class="table-list">
      <table width="100%" cellspacing="0">
        <thead>
          <tr class="first_tr">
            <th width="40">序号</th>
            <th width="15"><input type="checkbox" value="" id="check_box" onclick="checkAll();"></th>
            <th width="40">ID</th>
            <th>分类名称</th>
            <th width="30">排序</th>
            <th width="30">首页</th>
            <th width="30">审核</th>
            <th width="30">操作</th>
          </tr>
        </thead>
        <tbody>
		<{section loop=$lists name=item}>
          <tr>
            <td align="center"><a href="/index.php?a=product&id=<{$lists[item].id}>" target="_blank"><{$lists[item].id}></a></td>
            <td align="center"><input data-id="<{$lists[item].id}>" class="check yiji" type="checkbox" value="<{$lists[item].id}>" name="id[]"></td>
            <td align="center"><a class="blue" href="index.php?a=index&amp;m=item&amp;id=106" target="_blank"><{$lists[item].id}></a></td>
            <td align="center"><a href="<{$lists[item].item_link}>" target="_blank"><{$lists[item].className}></a></td>
            
            <td align="center"><input type="text" class="input-text-c input-text" size="4" value="<{$lists[item].sort}>" name="sort" id="listorders[106]" ></td>
            <td align="center" onclick="status(<{$lists[item].id}>,'is_index')" id="is_index_<{$lists[item].id}>"><img src="/assets/images/status_<{$lists[item].is_index}>.gif"></td>
            <td align="center" onclick="status(<{$lists[item].id}>,'status')" id="status_<{$lists[item].id}>"><img src="/assets/images/status_<{$lists[item].status}>.gif"></td>
            <td align="center"><a class="blue" href="/admin.php?m=class&a=edit&id=<{$lists[item].id}>">编辑</a></td>
          </tr>
		   <{section loop=$lists[item].children name=son}>
			 <tr>
            <td align="center"><{$lists[item].children[son].id}></td>
            <td align="center"><input class="check erji<{$lists[item].id}>" type="checkbox" value="<{$lists[item].children[son].id}>" name="id[]"></td>
            <td align="center"><a class="blue" href="index.php?a=index&amp;m=item&amp;id=106" target="_blank"><{$lists[item].children[son].id}></a></td>
            
            <td align="center"><a style="margin-left:30px;" href="{$item.item_link}" target="_blank"><{$lists[item].children[son].className}></a></td>
            
            <td align="center"><input type="text" class="input-text-c input-text" size="4" name="sort" value="<{$lists[item].children[son].sort}>" id="listorders[106]" ></td>
            <td align="center" onclick="status(<{$lists[item].children[son].id}>,'is_index')" id="is_index_<{$lists[item].children[son].id}>"><img src="/assets/images/status_<{$lists[item].children[son].is_index}>.gif"></td>
            <td align="center" onclick="status(<{$lists[item].children[son].id}>,'status')" id="status_<{$lists[item].children[son].id}>"><img src="/assets/images/status_<{$lists[item].children[son].status}>.gif"></td>
            <td align="center"><a class="blue" href="/admin.php?m=class&a=edit&id=<{$lists[item].children[son].id}>">编辑</a></td>
			</tr>
			<{/section}>
		  <{/section}>
        </tbody>
      </table>
      <div class="btn">
        <label for="check_box" style="float:left;">全选/取消</label>
        <input type="submit" onclick="del()" class="button" name="dosubmit" value="删除" style="float:left;margin:0 10px 0 10px;">
        <input type="submit" class="button" name="dosubmit" value="排序">
        <input type="submit" class="button" name="dosubmit" value="更新">
        <div id="pages">
			<{$page}>
		</div>
      </div>
    </div>
</form>
</div>
</body>
<script src="/assets/js/jquery.js"></script>
<script>
function checkAll(){
	
	$(".check").attr("checked",$("#check_box").attr("checked"));
}
function del(){
	if(confirm('你确定要删除吗？')){
		$("#form1").attr("action","?m=class&a=del");
	}else{
		return;
	}
}
function status(id,type){
    $.get("/admin.php?a=status&m=class", { id: id, type: type }, function(jsondata){
		//alert(jsondata);
		$("#"+type+"_"+id+" img").attr('src', '/assets/images/status_'+jsondata+'.gif')
	}); 
}

$(".yiji").click(function(){
	//alert($)
	$(".erji"+$(this).attr("data-id")).attr("checked",$(this).attr("checked"));
});
</script>
